import 'package:flutter/material.dart';

void main() {
  runApp(const MaterialApp(home: HomePage()));
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

// class _HomePageState extends State<HomePage> {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//       home: Scaffold(
//         appBar: AppBar(title: const Text('你好flutter1')),
//         // TODO 页面滑动
//         body: PageView(
//           scrollDirection: Axis.vertical, // 滑动方向
//           children: const [
//             Center(child: Text('第1页')),
//             Center(child: Text('第2页')),
//             Center(child: Text('第3页')),
//             Center(child: Text('第4页')),
//             Center(child: Text('第5页')),
//           ],
//         ),
//       ),
//     );
//   }
// }

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('你好flutter1')),
        body: PageView.builder(
          itemCount: 5,
          itemBuilder: (context, index) {
            return Center(child: Text('第${index + 1}页'));
          },
        ),
      ),
    );
  }
}
